﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TvViewer
{
  public partial class TranspControl : UserControl
  {
    public TranspControl()
    {
      InitializeComponent();
      SetStyle(ControlStyles.SupportsTransparentBackColor, true);
      SetStyle(ControlStyles.Opaque, true);
      this.BackColor = Color.Transparent;
    }

    protected override CreateParams CreateParams
    {
      get
      {
        CreateParams cp = base.CreateParams;
        cp.ExStyle |= 0x20;
        return cp;
      }
    }

    protected override void OnPaint(PaintEventArgs e)
    {
      e.Graphics.DrawLine(new Pen(new SolidBrush(Color.Red)), new Point(0, 20), new Point(200, 20));
      base.OnPaint(e);
    }

    //private const int WM_NCHITTEST = 0x84;
    //private const int HTCLIENT = 0x1;
    //private const int HTCAPTION = 0x2;

    /////
    ///// Handling the window messages
    /////
    //protected override void WndProc(ref Message message)
    //{
    //  base.WndProc(ref message);

    //  if (message.Msg == WM_NCHITTEST && (int)message.Result == HTCLIENT)
    //    message.Result = (IntPtr)HTCAPTION;
    //}
  }
}
